<?php require('../data/dbcon.php'); ?>
<?php require('../data/functions.php'); ?>
<?php
session_start();
$showerror = null;
$UserChk = checkUser($_COOKIE['winnguestbook_u'], $_COOKIE['winnguestbook_auth']);
if( $UserChk == FALSE ) {
	header("location: index.php");
}
//Start the Stats Class
$stats = new Stats();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">@import url('css/admin.css'); </style>

<script type="text/javascript" src="js/prototypejs.js"></script>
<script type="text/javascript" src="js/scriptaculous.js"></script>
<script type="text/javascript" src="js/Winnjs.js"></script>
<title>Winn Guestbook <?=$version; ?></title>

</head>

<body>
<div id="adminheader">
	<?php include('inc/sitename.php'); ?>
    <ul id="stats">
<?php include('inc/header.php'); ?>

<div class="content" id="settingspage">
        <?=$showerror; ?>
	<h3>Guestbook Stats</h3>
	<p>Below you can follow the traffic on your guestbook all in real time.</p>
	
	<h3>Latest Activity</h3>
	<p>Below is activity from the last 7 days.</p>
		<img src="http://chart.apis.google.com/chart?
		chs=700x300
		&chd=t:<?=$stats->day(6);?>,<?=$stats->day(5);?>,<?=$stats->day(4);?>,<?=$stats->day(3);?>,<?=$stats->day(2);?>,<?=$stats->day(1);?>,<?=$stats->day(0);?>|
		<?=$stats->day(13);?>,<?=$stats->day(12);?>,<?=$stats->day(11);?>,<?=$stats->day(10);?>,<?=$stats->day(9);?>,<?=$stats->day(8);?>,<?=$stats->day(7);?>
		&cht=lc
		&chco=113562,AFC7E4
		&chl=<?=$stats->daydate(6);?>|<?=$stats->daydate(5);?>|<?=$stats->daydate(4);?>|<?=$stats->daydate(3);?>|<?=$stats->daydate(2);?>|<?=$stats->daydate(1);?>|<?=$stats->daydate(0);?>
		&chxt=y
		&chds=0,<?=$stats->highnumber('day',6);?>,0,<?=$stats->highnumber('day',6);?>
		&chxr=0,0,<?=$stats->highnumber('day',6);?>
		&chf=bg,s,FFFFFF" 
		alt="Last 7 Days of posts" />
		
		<p><img src="../img/thisweek_key.jpg" alt="This Week" style="float:left;" /> This Week</p>
		<p><img src="../img/lastweek_key.jpg" alt="This Week" style="float:left;" /> Last Week</p>

</div>
<?php include('inc/footer.php');?>
</body>
</html>
